import getRobotTextService from '../../../util/robot/index';

// 通过腾讯云机器人获取对话文字
export async function getRobotText(ctx: Context, next: Next): Promise<void> {
  const { text } = ctx.request.body;

  try {
    const result = await getRobotTextService(text);
    ctx.api.success(result, 'sucess');
  } catch (error) {
    ctx.api.fail(-1, error);
  }
  
  return next();
}
